package com.example.springstack.mybatisplus.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @author qiangfanghao
 * @date
 * 用户角色表
 */

@Data
@Entity
@Table(name = "user_role")
public class UserRole  implements Serializable {
    private static final long serialVersionUID = 1L;


    /**
     * userId
     * 外键 : @TableId(type = IdType.INPUT)
     */
    @Id
    @GenericGenerator(name = "assigned", strategy = "assigned")
    @GeneratedValue(generator = "assigned")
    @TableId(type = IdType.INPUT)
    @Column(name = "user_id", length = 32, nullable = false)
    private Long userId;


    /**
     * 角色id
     */
    @Id
    @GenericGenerator(name = "assigned", strategy = "assigned")
    @GeneratedValue(generator = "assigned")
    @Column(name = "role_id", length = 20, nullable = false)
    private Long roleId;

    public UserRole() {
    }
}
